﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VisionCore;

namespace COER
{
    public partial class RTCView : Form
    {
        public RTCView()
        {
            InitializeComponent();
        }

        public void ShowForm()
        {
            this.Show();
            this.WindowState = FormWindowState.Normal;
            timer1.Start();
            this.Activate();
        }

        private void RTCView_Load(object sender, EventArgs e)
        {
            db_Remote.Manual_Load("IOBlock.xlsx", "Remote");
            db_Local.Manual_Load("IOBlock.xlsx", "Local");
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.Visible == false || this.WindowState == FormWindowState.Minimized) return;

            db_Remote.RefreshListView(RTCHelper.RTC_COM.RemoteToLocal);
            db_Local.RefreshListView(RTCHelper.RTC_COM.LocalToRemote);
            //db_Remote.RefreshListView();
            //db_Local.RefreshListView();
        }

        private void HandshakeView_FormClosing(object sender, FormClosingEventArgs e)
        {
            timer1.Stop();
            this.Visible = false;
            e.Cancel = true;
        }
    }
}
